home *** CD-ROM | disk | FTP | other *** search
- Path: airdmhor.gen.nz!not-for-mail
- From: gumboot@airdmhor.gen.nz (Simon Hosie)
- Newsgroups: comp.lang.c
- Subject: Re: Non arithmetic integer type.
- Date: 19 Mar 1996 01:41:38 +1200
- Organization: Airdmhor : a couple of BBS's, a bunch of people, and a cat.
- Message-ID: <4ijp6i$cdu@airdmhor.gen.nz>
- References: <4igp11$83a@airdmhor.gen.nz> <4ihfjcINNss6@keats.ugrad.cs.ubc.ca>
- NNTP-Posting-Host: airdmhor.gen.nz
- X-Newsreader: TIN [version 1.2 PL2]
-
- In article <4igp11$83a@airdmhor.gen.nz>,
- Simon Hosie <gumboot@airdmhor.gen.nz> wrote:
- > I've been trying to create a data type that holds an int or intlike chunk
- > of data that is incompatible with any other types (to generate errors if
- > someone assumes that it's the same type as an int).. I've found that
- >
- > typedef struct { int Value; } TypeA;
- > typedef struct { int ValueWithADifferentName; } TypeB;
- >
- > makes two compatible types; a variable of TypeA can be assigned to a
- > variable of TypeB without any warnings.. but
-
- Kazimir Kylheku:
- > Your compiler has a gratuitous extension that allows for structural
- > equivalence type checking.
-
- > In standard C, structures with a different tag name are different. Structures
- > declard with _no tag_ are always incompatible with each other and with other
- > structures that have tags.
-
- So, do you reckon that if I gave then tags that were _different_ rather
- than absent then they would have another chance at being recognised as
- different? [Jumps to D*S shell..] Nope.. Let's try unions.. Nope.. .CPP
- extention.. Got it.
-
- Is it a C rule or a C++ rule that they be incompatible?
-